package com.csii.galaxy.studio.service;

import com.csii.core.api.Result;
import com.csii.core.system.vo.SyncDictVo;
import com.csii.galaxy.studio.entity.ActStartFlowInstance;
import com.csii.galaxy.studio.entity.ActStartFlowInstanceIframeUrl;
import com.csii.galaxy.studio.entity.SendMessage;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

public interface GalaxyStudioBaseService {

    @GetMapping("/sys/dict/queryTableDictTextByKey")
    String queryTableDictTextByKey(@RequestParam("table") String table, @RequestParam("text") String text, @RequestParam("code") String code, @RequestParam("key") String key);

    @GetMapping("/sys/dict/queryDictTextByKey")
    String queryDictTextByKey(@RequestParam("code") String code, @RequestParam("key") String key);

    /**
     * 通过消息中心模板，生成推送内容
     *
     * @param templateCode 模板编码
     * @param map          模板参数
     * @return
     */
    @PostMapping("/sys/common/parseTemplateByCode/{templateCode}")
    String parseTemplateByCode(@PathVariable("templateCode") String templateCode, @RequestBody Map<String, String> map);
    /**
     * 发送系统消息
     * @param sendMessage 消息实体
     */
    @PostMapping("/sys/annountCement/sendSysAnnouncement/api")
    Result sendSysAnnouncement(@RequestBody SendMessage sendMessage);
    /**
     * 发送系统消息
     * @param actBusId 流程业务id
     * @param fromUser 发送人(用户登录账户)
     * @param fromUser 发送人(用户登录账户)
     * @param toUser  发送给(用户登录账户)
     * @param title  消息主题
     * @param msgContent  消息内容
     */
    @GetMapping("/sys/annountCement/sendSysAnnouncementAct")
    Result sendSysAnnouncementAct(@RequestParam("actBusId") String actBusId, @RequestParam("fromUser") String fromUser, @RequestParam("toUser") String toUser, @RequestParam("title") String title, @RequestParam("msgContent") String msgContent);

    @GetMapping("/sys/dict/syncDict/{redisListKey}/{lastSyncResult}")
    SyncDictVo syncDict(@PathVariable("redisListKey") String redisListKey,@PathVariable("lastSyncResult")Integer lastSyncResult);

    @GetMapping("/oauthClientDetails/queryClientIdList")
    Result<List<String>> queryClientIdList();

    /**
     * 收费扣次，正常返回code=0；异常返回code=503
     * @param appCode
     * @param count
     * @return
     */
    @GetMapping(value = "/sysSaasAppInfo/pay")
    Result pay(@RequestParam("appCode") String appCode,@RequestParam("count") int count);

    /**
     * 验证收费，正常返回code=0；异常返回code=503
     * @param appCode
     * @return
     */
    @GetMapping(value = "/sysSaasAppInfo/costAuth")
    Result costAuth(@RequestParam("appCode") String appCode);

    /**
     * 启动流程
     * @param startFlowInstance
     * @return
     */
    @ApiOperation("启动流程")
    @PostMapping("/activiti/flow/operation/startFlowInstanceByKey")
    Result startFlowInstanceByKey(@RequestBody ActStartFlowInstance startFlowInstance);

    /**
     * 启动流程iframe模式
     * @param startFlowInstanceIframeUrl
     * @return
     */
    @PostMapping("/activiti/flow/operation/startFlowInstanceIframeUrlByKey")
    Result startFlowInstanceIframeUrlByKey(@RequestBody ActStartFlowInstanceIframeUrl startFlowInstanceIframeUrl);

}
